#!/bin/bash
APP_PROPERTIES="/h01/app.properties"
declare -A newProperties=(["name"]="ITS" 
    ["its.port"]="9999"
    ["its.ip"]="10.2.3.5"
    ["its.maxLine"]="50"
)

for i in "${!newProperties[@]}"
do
    FOUND=`grep -ce "$i" $APP_PROPERTIES`
    if [ "$FOUND" == "0" ]; then
        echo "adding $i - ${newProperties["$i"]}"
        sed -i.backup '$a'$i'='${newProperties["$i"]}'' $APP_PROPERTIES
        echo "done adding $i - ${newProperties["$i"]}"
    else
        echo "$i already exists"
    fi
done